<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //Promise链式调用：使用方法接受的数据是resolve方法传过来的参数，或者是上一次then方法的返回值
        // Promise。resolve方法是构造函数中回调含糊参数resolve
        new Promise((resolve,reject) => {
            setInterval(() => {
                if(Math.random() > 0.5){
                    resolve('成功')
                }else{
                    reject('失败')
                }
            },500)
        }).then(res => {
            
        })
    </script>
</body>
</html>